import time
import tkinter
from tkinter import Label


# def get_time():
#     '''显示当前时间'''
#
#     time2 = time.strftime('%Y-%m-%d %H:%M:%S')
#     clock = Label(top, text=time2, font=28)
#     clock.place(x=15, y=120)
#     clock.after(1000,get_time)
#
# top = tkinter.Tk()
# top.geometry('500x300')
# get_time()
# top.mainloop()
import threading



top = tkinter.Tk()
top.geometry('500x300')


clock = Label(top,text='',font=28)
clock.place(x=15, y=120)
def f():
    while True:
        clock.configure(text=time.strftime('%Y-%m-%d %H:%M:%S'))
        time.sleep(1)
thread = threading.Thread(target=f)
thread.setDaemon(True)
thread.start()
top.mainloop()